package com.ruoyi.web.controller.yijing;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yijing.domain.YjCustomerGua;
import com.ruoyi.yijing.service.IYjCustomerGuaiService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 用户占卜到的卦Controller
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/yijing/cust/guai")
public class YjCustomerGuaiController extends BaseController
{
    @Autowired
    private IYjCustomerGuaiService yjCustomerGuaiService;

    /**
     * 查询用户占卜到的卦列表
     */
    //@PreAuthorize("@ss.hasPermi('yijing:guai:list')")
    @GetMapping("/list")
    public TableDataInfo list(YjCustomerGua yjCustomerGuai)
    {
        startPage();
        List<YjCustomerGua> list = yjCustomerGuaiService.selectYjCustomerGuaiList(yjCustomerGuai);
        return getDataTable(list);
    }


    /**
     * 获取用户占卜到的卦详细信息
     */
    //@PreAuthorize("@ss.hasPermi('yijing:guai:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yjCustomerGuaiService.selectYjCustomerGuaiById(id));
    }

    /**
     * 新增用户占卜到的卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:guai:add')")
    @Log(title = "用户占卜到的卦", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YjCustomerGua yjCustomerGuai)
    {
        return toAjax(yjCustomerGuaiService.insertYjCustomerGuai(yjCustomerGuai));
    }

    /**
     * 修改用户占卜到的卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:guai:edit')")
    @Log(title = "用户占卜到的卦", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YjCustomerGua yjCustomerGuai)
    {
        return toAjax(yjCustomerGuaiService.updateYjCustomerGuai(yjCustomerGuai));
    }

    /**
     * 删除用户占卜到的卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:guai:remove')")
    @Log(title = "用户占卜到的卦", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yjCustomerGuaiService.deleteYjCustomerGuaiByIds(ids));
    }
}
